<script lang="ts" setup>
import { Menu } from '@/api/system/menus/type'
import { Icon } from '@iconify/vue'

interface Prop {
    menu: Menu
}
const props = defineProps<Prop>()
</script>

<template>
    <el-sub-menu :index="props.menu.routePath" v-if="props.menu.children.length > 0">
        <template #title>
            <el-icon>
                <Icon :icon="props.menu.icon" />
            </el-icon>
            <span>{{ props.menu.name }}</span>
        </template>
        <SidebarMenuItem v-for="menu in props.menu.children" :menu="menu" />
    </el-sub-menu>
    <el-menu-item :index="props.menu.routePath" v-else>
        <el-icon>
            <Icon :icon="props.menu.icon" />
        </el-icon>
        <template #title>
            {{ props.menu.name }}
        </template>
    </el-menu-item>
</template>

<style scoped lang="scss"></style>